package com.example.demo.util;

import cn.hutool.core.util.IdUtil;

import java.util.Random;

public class RandomUtil {

    public static String random()
    {
        String codeId = IdUtil.simpleUUID();
        return codeId+"_"+randomCc();
    }

    private static String randomCc()
    {
        String chars = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789";
        StringBuilder sb = new StringBuilder();
        Random random = new Random();
        for (int i = 0; i < 8; i++) {
            int index = random.nextInt(chars.length());
            sb.append(chars.charAt(index));
        }
        return sb.toString();
    }
}
